home *** CD-ROM | disk | FTP | other *** search
Wrap
ccccllll____ccccoooossssmmmmoooo((((3333ddddmmmm)))) ccccllll____ccccoooossssmmmmoooo((((3333ddddmmmm)))) NNNNAAAAMMMMEEEE cl_cosmo - Cosmo Compress JPEG Accelerator (in the Compression Library) SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS ####iiiinnnncccclllluuuuddddeeee <<<<ddddmmmmeeeeddddiiiiaaaa////ccccllll....hhhh>>>> DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN Cosmo Compress is an optional hardware accelerator for JPEG image compression. The programming interface to Cosmo is via the standard Compression Library. For overviews of the JPEG standard and the CL API, see _j_p_e_g(4) and _C_L_i_n_t_r_o(3dm). Cosmo Compress implements a subset of the JPEG standard optimized for video originated images. This subset is baseline JPEG, interleaved YCrCb, 8-bits per component. Cosmo Compress is capable of compressing and decompressing to and from memory, or to and from a special video connection to IndyVideo, Galileo Video, or Indigo2 Video. Cosmo also supports an arbitrary scale down and clip of images being decompressed. This scaling happens without any performance penalty and produces high quality results. PPPPRRRROOOOGGGGRRRRAAAAMMMMMMMMIIIINNNNGGGG CCCCOOOOSSSSMMMMOOOO CCCCOOOOMMMMPPPPRRRREEEESSSSSSSS Cosmo Compress is programmed via the Compression Library (CL) utilizing the base CL API as well as JPEG-specific and Cosmo-specific parameters. UUUUSSSSIIIINNNNGGGG CCCCOOOOSSSSMMMMOOOO The Cosmo Compress JPEG Codec is invoked by specifying CL_JPEG_COSMO as the scheme argument to ccccllllOOOOppppeeeennnnCCCCoooommmmpppprrrreeeessssssssoooorrrr.... Only one application can have Cosmo open at a time. An error will be returned to the program if another application has Cosmo open. SSSSEEEETTTTTTTTIIIINNNNGGGG UUUUPPPP TTTTRRRRAAAANNNNSSSSFFFFEEEERRRRSSSS Cosmo is capable of four different modes of operation. External video can be compressed to a memory buffer, a memory buffer can be decompressed and sent out to external video, an image in memory can be compressed to memory, and a compressed image can be decompressed to memory. Video data is always treated as non-interleaved fields. Memory to memory transfers may be initiated using the standard CL calls. The size of the uncompressed image must not be larger than a PAL video field (768x288). The uncompressed data format must be CL_FORMAT_XBGR. Transfers to and from external video should use the CL direct buffered interface specifying CL_EXTERNAL_DEVICE as the _f_r_a_m_e_B_u_f_f_e_r parameter to ccccllllCCCCoooommmmpppprrrreeeessssssss or ccccllllDDDDeeeeccccoooommmmpppprrrreeeessssssss. Additionally, the call to ccccllllDDDDeeeeccccoooommmmpppprrrreeeessssssss or ccccllllCCCCoooommmmpppprrrreeeessssssss should either be made by a separate thread within the program or with CL_CONTINUOUS_NONBLOCK as the frame count parameter since it will not return until the transfer is complete. PPPPaaaaggggeeee 1111 ccccllll____ccccoooossssmmmmoooo((((3333ddddmmmm)))) ccccllll____ccccoooossssmmmmoooo((((3333ddddmmmm)))) PPPPAAAARRRRAAAAMMMMEEEETTTTEEEERRRRSSSS :::: GGGGEEEENNNNEEEERRRRAAAALLLL CCCCLLLL The following general CL parameters are useful for Cosmo. For more information, see _C_L_i_n_t_r_o(3dm). CCCCLLLL____IIIIMMMMAAAAGGGGEEEE____WWWWIIIIDDDDTTTTHHHH Uncompressed image width, in pixels. When transfering to or from external video using NTSC timing, the width must be 640. When transfering to or from external video using PAL timing, the width must be 768. The maximum width in memory to memory transfers is 768. The width must always be a multiple of 16. With IndyVideo601 option or Galileo on Indigo2, both CCIR 525 and CCIR 625 sizes are supported. CCCCLLLL____IIIIMMMMAAAAGGGGEEEE____HHHHEEEEIIIIGGGGHHHHTTTT Uncompressed image height in pixels. Since Cosmo deals in fields which represent every other line of a video frame, the image height is half of the full frame height. The height must always be a multiple of 8. The external video port on Cosmo transmits 243 lines per field in NTSC mode which is not a multiple of 8. Applications should therefore either specify 240 or 248 as the height for NTSC. The height for PAL should be 288. With IndyVideo601 option or Galileo on Indigo2, both CCIR 525 and CCIR 625 sizes are supported. CCCCLLLL____IIIINNNNTTTTEEEERRRRNNNNAAAALLLL____IIIIMMMMAAAAGGGGEEEE____WWWWIIIIDDDDTTTTHHHH Width of compressed image. This is normally the same as CL_IMAGE_WIDTH, but may be different when scaling is used. Cosmo has two types of image scaling capability. When decompressing from memory to memory, the image may be downsized from the original. This mode of scaling is enabled by setting CL_IMAGE_WIDTH to the desired reduced size while setting CL_INTERNAL_IMAGE_WIDTH to the original size contained in the JPEG data. When compressing or decompressing from external video, Cosmo supports a limited form of scaling. If the CL_IMAGE_WIDTH is set to the width of the video field (either 640 or 768), and CL_INTERNAL_IMAGE_WIDTH is set to one half of that (either 320 or 384), then Cosmo will scale the image by a factor of two. It is only necessary to set this parameter if one of these two types of scaling is desired. CCCCLLLL____IIIINNNNTTTTEEEERRRRNNNNAAAALLLL____IIIIMMMMAAAAGGGGEEEE____HHHHEEEEIIIIGGGGHHHHTTTT Height of compressed image. This is normally the same as CL_IMAGE_HEIGHT, but may be different when scaling is used. See the discussion of CL_INTERNAL_IMAGE_WIDTH above. CCCCLLLL____FFFFOOOORRRRMMMMAAAATTTT When decompressing or compressing to or from memory, Cosmo only recognizes 32-bit RGB pixels which are called CL_FORMAT_XBGR by the CL. CCCCLLLL____AAAALLLLGGGGOOOORRRRIIIITTTTHHHHMMMM____IIIIDDDD The algorithm identifier for Cosmo is CL_JPEG_COSMO. PPPPaaaaggggeeee 2222 ccccllll____ccccoooossssmmmmoooo((((3333ddddmmmm)))) ccccllll____ccccoooossssmmmmoooo((((3333ddddmmmm)))) CCCCLLLL____OOOORRRRIIIIEEEENNNNTTTTAAAATTTTIIIIOOOONNNN Cosmo treats images as ``top down'' and has no support for flipping images. CCCCLLLL____EEEENNNNAAAABBBBLLLLEEEE____IIIIMMMMAAAAGGGGEEEEIIIINNNNFFFFOOOO Setting this parameter to ``TRUE'' enables the ccccllllGGGGeeeettttNNNNeeeexxxxttttIIIImmmmaaaaggggeeeeIIIInnnnffffoooo(3dm) CL function which can be used to retrieve time stamp and other information about compressed fields. In the case of Cosmo compressing from external video, the time stamp returned represents the time at which the first line of the uncompressed field arrived at the Cosmo board. PPPPAAAARRRRAAAAMMMMEEEETTTTEEEERRRRSSSS :::: JJJJPPPPEEEEGGGG The following JPEG parameters may also be used. See _c_l__j_p_e_g(3dm) for descriptions. CCCCLLLL____JJJJPPPPEEEEGGGG____QQQQUUUUAAAALLLLIIIITTTTYYYY____FFFFAAAACCCCTTTTOOOORRRR CCCCLLLL____JJJJPPPPEEEEGGGG____QQQQUUUUAAAANNNNTTTTIIIIZZZZAAAATTTTIIIIOOOONNNN____TTTTAAAABBBBLLLLEEEESSSS CCCCLLLL____JJJJPPPPEEEEGGGG____SSSSTTTTRRRREEEEAAAAMMMM____HHHHEEEEAAAADDDDEEEERRRRSSSS PPPPAAAARRRRAAAAMMMMEEEETTTTEEEERRRRSSSS :::: CCCCOOOOSSSSMMMMOOOO These parameters are specific to Cosmo. CCCCLLLL____CCCCOOOOSSSSMMMMOOOO____VVVVIIIIDDDDEEEEOOOO____TTTTRRRRAAAANNNNSSSSFFFFEEEERRRR____MMMMOOOODDDDEEEE Type: CL_ENUM_VALUE When transfering to or from external video, the video may be played continuously or single stepped a field or frame at a time. Cosmo has three different transfer modes. CL_COSMO_VIDEO_TRANSFER_AUTO_1_FIELD, and CL_COSMO_VIDEO_TRANSFER_AUTO_2_FIELD put the board in continuous mode. CL_COSMO_VIDEO_TRANSFER_MANUAL puts the board in single step mode. In any mode, the frame output is either composed of (every) single field replicated twice, or two different fields. CCCCLLLL____CCCCOOOOSSSSMMMMOOOO____VVVVIIIIDDDDEEEEOOOO____MMMMAAAANNNNUUUUAAAALLLL____CCCCOOOONNNNTTTTRRRROOOOLLLL Type: CL_ENUM_VALUE When the video transfer mode is set to manual, the output is advanced one step by setting this parameter to CL_COSMO_VIDEO_MANUAL_ADVANCE. In order for the frame to actually advance, there must be a decompressed frame in Cosmo's output queue. CCCCLLLL____CCCCOOOOSSSSMMMMOOOO____CCCCOOOODDDDEEEECCCC____CCCCOOOONNNNTTTTRRRROOOOLLLL Type: CL_ENUM_VALUE Setting to CL_COSMO_STOP will cause compression or decompression to halt. If clCompress or clDecompress had been called with CL_CONTINUOUS_BLOCK, it will now return. If clCompress or clDecompress had been called with CL_CONTINUOUS_NONBLOCK, the associated thread will terminate. PPPPaaaaggggeeee 3333 ccccllll____ccccoooossssmmmmoooo((((3333ddddmmmm)))) ccccllll____ccccoooossssmmmmoooo((((3333ddddmmmm)))) CCCCLLLL____CCCCOOOOSSSSMMMMOOOO____VVVVIIIIDDDDEEEEOOOO____IIIINNNNPPPPUUUUTTTT____CCCCOOOONNNNTTTTRRRROOOOLLLL This is used to control how the external video device sends timing information to Cosmo. It is only needed when using Cosmo with the IndyVideo/Galileo 601 Option. It may be set to either CL_COSMO_VIDEO_INPUT_PORT0, or CL_COSMO_VIDEO_INPUT_PORT1. CCCCOOOONNNNNNNNEEEECCCCTTTTIIIINNNNGGGG TTTTOOOO VVVVIIIIDDDDEEEEOOOO When using external video with Cosmo, special attention needs to be given to the video synchronization setting of the video device. When capturing, the video synchronization should be set to ``slave''. When playing back, it should be set to either ``internal'' or ``genlock''. Cosmo interfaces with the external video via two vl nodes, one for sending video from Cosmo to the video board, and one for sending video and timing information from the video board to Cosmo. When playing back to external video, both nodes have to be used, one providing video timing to Cosmo, the other connecting Cosmo output to the video device. Video from IndyVideo/Galileo is sent on port 2 and video from Cosmo to IndyVideo/Galileo is sent back on port 1. The following will set play back from Cosmo, into a window with simultaneous video output. /* * Assume svr is the server from vlOpenVideo(3), * and dev is device number for the ``ev1'' device * obtained via vlGetDeviceList(3). */ /* * First, make sure the timing is set to internal * or genlock */ devNode = vlGetNode( svr, VL_DEVICE, VL_ANY ); path = vlCreatePath( svr, dev, devNode, devNode ); vlSetupPaths( svr, &path, 1, VL_SHARE, VL_READ_ONLY ); vlGetControl( svr, path, devNode, VL_SYNC, &val ); if (val.intVal == VL_SYNC_SLAVE) { val.intVal = VL_SYNC_INTERNAL; vlSetControl( svr, path, devNode, VL_SYNC, &val ); } vlDestroyPath(svr, path); /* * Now set up the video transfer paths */ cosmosrc = vlGetNode( svr, VL_SRC, VL_VIDEO, 1 ); cosmodrn = vlGetNode( svr, VL_DRN, VL_VIDEO, 2 ); videodrn = vlGetNode( svr, VL_DRN, VL_VIDEO, 0 ); windowdrn = vlGetNode( svr, VL_DRN, VL_SCREEN, VL_ANY ); PPPPaaaaggggeeee 4444 ccccllll____ccccoooossssmmmmoooo((((3333ddddmmmm)))) ccccllll____ccccoooossssmmmmoooo((((3333ddddmmmm)))) path = vlCreatePath( svr, dev, cosmosrc, windowdrn ); vlAddNode( svr, path, videodrn ); vlAddNode( svr, path, cosmodrn ); vlSetupPaths( svr, &path, 1, VL_SHARE, VL_SHARE ); /* * Set window for windowdrn */ val.intVal = windowId; vlSetControl( svr, path, windowdrn, VL_WINDOW, &val ); vlBeginTransfer( svr, path, 0, NULL ); See _g_a_l_i_l_e_o(7) and _v_l(3dm) for more information. FFFFIIIILLLLEEEESSSS /usr/include/dmedia/cl.h SSSSEEEEEEEE AAAALLLLSSSSOOOO jpeg(4), CLintro(3dm), cl_jpeg(3dm), vl(3dm), galileo(7) PPPPaaaaggggeeee 5555